#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

int c[210],sum,k,n;
char s[N];

void out(int x,int y){
	memset(c,0,sizeof(c)); sum = 0; for(int i = 1;i < x;i++) c[s[i]]++;
	for(int i = 1;i < x;i++) putchar(s[i]);
	putchar(y); c[y]++; sum = n - x; for(int i = 'a';i <= 'z';i++) sum -= (k - c[i] % k) % k;
	for(int i = 1;i <= sum;i++) putchar('a');
	for(int i = 'a';i <= 'z';i++){
		while((k - c[i] % k) % k)
			putchar(i),c[i]++;
	}puts("");
}

void solve(){
	n = in,k = in; scanf("%s",s+1);
	if(n % k) return puts("-1"),void();
	memset(c,0,sizeof(c)); sum = 0;
	for(int i = 1;i <= n;i++) c[s[i]]++;
	for(int i = 'a';i <= 'z';i++) sum += (k - c[i] % k) % k;
	if(sum == 0) return printf("%s\n",s+1),void();
	for(int i = n;i >= 1;i--){
	    sum -= (k - c[s[i]] % k) % k; c[s[i]]--; sum += (k - c[s[i]] % k) % k;
		for(int j = s[i] + 1;j <= 'z';j++){
			int cur = sum; cur -= (k - c[j] % k) % k; c[j]++; cur += (k - c[j] % k) % k; c[j]--;
			if(cur <= n-i) return out(i,j),void();
		}
	}
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	int t = in;
	while(t--) solve();
	return 0;
}

